<%-- 
    Document   : feUser
    Created on : 24.07.2011, 15:46:16
    Author     : Valentina
--%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="default.css" rel="stylesheet" type="text/css" />
        <title>User List</title>
    </head>
    <body>

        <jsp:include page="/WEB-INF/frontend/commons/header.jspf"></jsp:include>

        <table width="740" align="center" cellpadding="0" cellspacing="0" >
            <tr>
                <td>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td><img src="images/spacer.gif" alt="" width="100" height="30" /></td>
                        </tr>
                        <tr>
                            <td class="title">User List</td>
                        </tr>

                        <tr>
                            <td>
                                <ul class="error">
                                    <c:forEach var="error" items="${myErrors}" >
                                        <li> ${error.fieldName}</li>

                                    </c:forEach>
                                </ul>

                                <ul class="success">                                   
                                    <c:forEach var="success" items="${mySuccesMsg}" >
                                        <li> ${success}</li>
                                    </c:forEach>
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <form action="UserAddServlet" method="POST">
                                    <p>*Name <input type="text" name="name" value="" size="20" /></p>

                                    <p>*Login <input type="text" name="login" value="" size="20" /></p>

                                    <p>*Password <input type="password" name="password" value="" size="20" />(Minim 6 caractere)</p>
                                    <p> Group
                                        <select name="idGroup">
                                            <option value="0">Select One</option>
                                            <c:forEach var="group" items="${groups}">
                                                <option value="${group.id}">${group.name}</option>
                                            </c:forEach>
                                        </select>
                                    </p>
                                    <input type="submit" value="Add" />
                                </form>
                            </td>
                        </tr>
                        <tr>

                        <table class="border_table">
                            <thead>
                                <tr>
                                    <td>Nr.</td>
                                    <td>Name</td>
                                    <td>Login</td>
                                    <td>Update</td>
                                    <td>Delete</td>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach var="user" items="${users}" varStatus="status" >
                                    <tr>
                                        <td>${status.count}</td>
                                        <td>${user.name}</td>
                                        <td>${user.login}</td>
                                        <td><a href="UserPrepareUpdateServlet?iduser=${user.id}">Update</a></td>
                                        <td><a href="UserDeleteServlet?iduser=${user.id}" onclick="return confirm('Are you sure you want to delete?')">Delete</a></td>


                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>
            </tr>   

        </table>
    </td>
</tr>
</table>

<jsp:include page="/WEB-INF/frontend/commons/footer.jspf"></jsp:include>

</body>
</html>
